package com.hxw.schema.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Think on 2018/5/5.
 * 秘书--通知者
 */
public class SecretSubject implements Subject {

    private List<Observer> observerList = new ArrayList<Observer>();

    //增加
    public void attach(Observer observer){
        observerList.add(observer);
    }

    //移除
    public void detach(Observer observer){
        observerList.remove(observer);
    }

    //提醒
    public void notice(){
        for(Observer observer : observerList){
            observer.update();
        }
    }

}
